package com.xbongbong.saas.enums.dictionary;

import com.xbongbong.i18n.util.I18nMessageUtil;
import lombok.Getter;

import java.util.Objects;

/**
 * @author: yingjf
 * @date: 2022/8/17 09:42
 * @description:竞争对手产品体验
 */
@Getter
public enum CompetitorProductExperienceEnum {
    //    很好、较好、一般、差劲、极差、未知
    VERY_GOOD("1", "enum.competitorProductExperience.name.veryGood", "veryGood"),
    GOOD("2", "enum.competitorProductExperience.name.good", "good"),
    AVERAGE("3", "enum.competitorProductExperience.name.average", "average"),
    POOR("4", "enum.competitorProductExperience.name.poor", "poor"),
    VERY_POOR("5", "enum.competitorProductExperience.name.veryPoor", "veryPoor"),
    UNKNOWN("6", "enum.competitorProductExperience.name.unknown", "unknown"),
    ;
    private String code;
    private String name;
    private String attr;

    CompetitorProductExperienceEnum(String code, String name, String attr) {
        this.code = code;
        this.name = name;
        this.attr = attr;
    }

    public static CompetitorProductExperienceEnum getByCode(String code) {
        for (CompetitorProductExperienceEnum cache : values()) {
            if (Objects.equals(code, cache.code)) {
                return cache;
            }
        }
        return null;
    }

    public String getName() {
        return I18nMessageUtil.getMessage(name);
    }
}
